<script setup lang="ts">
import { ref } from 'vue'
import ImageMaskUploader from './components/ImageMaskUploader.vue'
import PiPLearningAssistant from './components/PiPLearningAssistant.vue'
import WaveChartDemo from './components/WaveChartDemo.vue'
import { initToolbar } from '@stagewise/toolbar'

// 只在开发环境启用
if (import.meta.env.MODE === 'development') {
  initToolbar({} as any)
}

// 定义当前活动组件
const activeComponent = ref<'imageMask' | 'pipLearning' | 'waveChart'>('imageMask')

// 切换组件的方法
const switchComponent = (component: 'imageMask' | 'pipLearning' | 'waveChart') => {
  activeComponent.value = component
}
</script>
<template>
  <div class="app-container">
    <h1>专利实现演示平台</h1>
    <p class="version">专利技术创新实现展示 v1.0.0</p>

    <!-- 导航菜单 -->
    <div class="nav-tabs">
      <button @click="switchComponent('imageMask')" :class="{ active: activeComponent === 'imageMask' }"
        class="nav-tab">
        图片隐私脱敏工具
      </button>
      <button @click="switchComponent('pipLearning')" :class="{ active: activeComponent === 'pipLearning' }"
        class="nav-tab">
        画中画学习助手
      </button>
      <button @click="switchComponent('waveChart')" :class="{ active: activeComponent === 'waveChart' }"
        class="nav-tab">
        水波动效柱状图
      </button>
    </div>

    <!-- 组件展示区域 -->
    <div class="component-container">
      <ImageMaskUploader v-if="activeComponent === 'imageMask'" />
      <PiPLearningAssistant v-if="activeComponent === 'pipLearning'" />
      <WaveChartDemo v-if="activeComponent === 'waveChart'" />
    </div>

    <footer>
      <p>© 2025 专利技术实现展示平台</p>
    </footer>

    <StagewiseToolbar :config="{ theme: 'auto' }" />
  </div>
</template>
<style scoped>
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

h1 {
  color: #333;
  text-align: center;
  margin-bottom: 10px;
}

.version {
  text-align: center;
  color: #666;
  font-size: 14px;
  margin-bottom: 20px;
}

.nav-tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.nav-tab {
  padding: 10px 20px;
  margin: 0 10px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
}

.nav-tab:hover {
  background-color: #e6f7ff;
  border-color: #1890ff;
}

.nav-tab.active {
  background-color: #ff7d00;
  color: white;
  border-color: #ff7d00;
  outline: none;
}

.component-container {
  min-height: 500px;
}

footer {
  margin-top: 40px;
  text-align: center;
  color: #666;
  font-size: 14px;
  border-top: 1px solid #eee;
  padding-top: 20px;
}
</style>
